#pragma once
#include <string>
#include "json.hpp" 
using json = nlohmann::json;

class Skill {
public:
    std::string name;
    std::string Info;
    
    int attack;
    int cost;//消耗量

    int hp;

    
    Skill(std::string n = "", std::string i = "",
        int c = 0, int at = 0, int h = 0)
        : name(n), Info(i), attack(at), cost(c), hp(h) {}

    json toJson() const {
        return {
            {"name", name},
            {"Info", Info},
            {"attack", attack},
            {"cost", cost},
            {"hp", hp}
        };
    }

    // 从JSON反序列化
    static Skill fromJson(const json& j) {
        return Skill(
            j["name"].get<std::string>(),
            j["Info"].get<std::string>(),
            j["cost"].get<int>(),
            j["attack"].get<int>(),
            j["hp"].get<int>()
        );
    }
};